home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / MODEMPRO / HOST110.ZIP;1 / HOST.SCR < prev    next >
Encoding:
Text File  |  1994-05-14  |  19.4 KB  |  778 lines

  1. '
  2. ' Host mode script for QmodemPro for Windows.
  3. '
  4. ' Version 1.0
  5. '
  6. ' Last updated February 26, 1993.
  7. '
  8. ' Alternative Host Mode for QmodemPro for Windows 1.10
  9.  
  10. '$include 'hostutil.scr'
  11.  
  12. ' Constants
  13.  
  14. const BS  = chr(8)
  15. const LF  = chr(10)
  16. const CR  = chr(13)
  17. const ESC = chr(27)
  18.  
  19. const PrelogFileNamePart   = "host.pre"
  20. const MenuFileNamePart     = "host.mnu"
  21. const ProtocolFileNamePart = "host.pro"
  22. const LogoffFileNamePart   = "host.off"
  23. const HelpFileNamePart     = "host.hlp"
  24.  
  25. const UserFileNamePart      = "host.usr"
  26. const MsgHeaderFileNamePart = "host.hdr"
  27. const MsgDetailFileNamePart = "host.msg"
  28.  
  29. const MaxMsgLines = 99
  30.  
  31. ' Type declarations
  32.  
  33. dialog SetupDialog 18, 18, 214, 200
  34.   caption "QmodemPro Host Setup"
  35.   groupbox "Mode", 101, 18, 9, 74, 64
  36.   modeopen as radiobutton "Open", 102, 26, 23, 62, 12
  37.   modeclosed as radiobutton "Closed", 103, 26, 38, 62, 12
  38.   modecallback as radiobutton "Callback", 104, 26, 53, 62, 12
  39.   groupbox "Security", 150, 100, 9, 100, 64
  40.   maxtime as edittext 105, 151, 22, 42, 12
  41.   dospass as edittext 106, 151, 39, 42, 12
  42.   shutdownpass as edittext 107, 151, 56, 42, 12
  43.   rtext "Max time", -1, 108, 25, 41, 8
  44.   rtext "DOS pwd", -1, 108, 41, 41, 8
  45.   rtext "Shutdown pwd", -1, 108, 59, 41, 8
  46.   groupbox "File transfers", 160, 18, 80, 182, 85
  47.   dlpath as edittext 108, 22, 104, 169, 12
  48.   ulpath as edittext 109, 22, 130, 169, 12
  49.   ltext "Download path", -1, 24, 95, 62, 8
  50.   ltext "Upload path", -1, 24, 120, 69, 8
  51.   sysopanypath as checkbox "Sysop can download from any path", 110, 25, 148, 165, 12
  52.   pushbutton "&Modem...", 200, 15, 175, 50, 14
  53.   defpushbutton "OK", IDOK, 80, 175, 50, 14
  54.   pushbutton "Cancel", IDCANCEL, 150, 175, 50, 14
  55. end dialog
  56.  
  57. dialog ModemSetupDialog 6, 15, 194, 179
  58.   caption "QmodemPro Host Modem Setup"
  59.   groupbox "", -1, 8, 9, 177, 139
  60.   init as edittext 101, 48, 17, 127, 12
  61.   answer as edittext 102, 48, 33, 47, 12
  62.   busy as edittext 103, 48, 49, 47, 12
  63.   ok as edittext 104, 48, 65, 47, 12
  64.   ring as edittext 105, 129, 33, 45, 12
  65.   ringcount as edittext 106, 148, 49, 27, 12
  66.   faxanswer as checkbox "&Fax answer", 107, 40, 86, 50, 12
  67.   faxato as checkbox "&Send ATO", 108, 110, 86, 50, 12
  68.   rtext "&Init", -1, 16, 19, 28, 8
  69.   rtext "&Answer", -1, 12, 34, 33, 8
  70.   rtext "&Busy", -1, 12, 50, 33, 8
  71.   rtext "&OK msg", -1, 13, 66, 32, 8
  72.   rtext "&Ring", -1, 105, 35, 20, 8
  73.   rtext "Ring &Count", -1, 106, 51, 38, 8
  74.   ltext "Note: Some modems (like US Robotics) require an ATO when answering a DATA call in auto FAX/DATA mode. Check the Send ATO box if your modem requires this.", -1, 20, 100, 150, 40
  75.   defpushbutton "OK", IDOK, 77, 156, 50, 14
  76.   pushbutton "Cancel", IDCANCEL, 137, 156, 50, 14
  77. end dialog
  78.  
  79. type TUser
  80.   Name as string*25
  81.   Password as string*20
  82.   Level as integer
  83.   Phone as string*30
  84. end type
  85.  
  86. type TMessageHeader
  87.   Sender as string*25
  88.   Receiver as string*25
  89.   Subject as string*75
  90.   DateTime as string*20
  91.   Private as integer
  92.   Received as integer
  93.   Killed as integer
  94.   Lines as integer
  95.   Detailpos as long
  96. end type
  97.  
  98. ' connection variables
  99. dim Local as integer
  100. dim Port as integer
  101. dim ModemResult as string
  102. dim BaudRate as long
  103. dim LogonTime as DateTimeRec
  104. dim LogoffTime as DateTimeRec
  105. dim ForceLogoff as integer
  106.  
  107. dim Setup as SetupDialog
  108. dim ModemSetup as ModemSetupDialog
  109. dim User as TUser
  110. dim MsgLines(MaxMsgLines) as string
  111.  
  112. dim PrelogFileName as string
  113. dim MenuFileName as string
  114. dim ProtocolFileName as string
  115. dim LogoffFileName as string
  116. dim HelpFileName as string
  117. dim UserFileName as string
  118. dim MsgHeaderFileName as string
  119. dim MsgDetailFileName as string
  120.  
  121. dim ReceivedFaxes as integer
  122.  
  123. '$include 'hostcfg.scr'
  124.  
  125. declare sub PackMessages
  126.  
  127. ' Utility routines
  128.  
  129. sub GetCurrentTime(dt as DateTimeRec)
  130.   do
  131.     dt.D = Today
  132.     dt.T = CurrentTime
  133.   loop until dt.D = Today
  134. end sub
  135.  
  136. function MinutesSince(dt as DateTimeRec)
  137.   dim now as DateTimeRec
  138.   call GetCurrentTime(now)
  139.   while now.D > dt.D
  140.     now.D = now.D - 1
  141.     now.T = now.T + SecondsInDay
  142.   wend
  143.   MinutesSince = (now.T - dt.T) / 60
  144. end function
  145.  
  146. function MinutesUntil(dt as DateTimeRec)
  147.   dim now as DateTimeRec
  148.   call GetCurrentTime(now)
  149.   while dt.D > now.D
  150.     now.D = now.D + 1
  151.     now.T = now.T - SecondsInDay
  152.   wend
  153.   MinutesUntil = (dt.T - now.T) / 60
  154. end function
  155.  
  156. function TimeLeft as integer
  157.   TimeLeft = MinutesUntil(LogoffTime)
  158. end function
  159.  
  160. function CallerHungUp as integer
  161.   CallerHungUp = (not Local and not Carrier) or ForceLogoff
  162. end function
  163.  
  164. sub DoChat
  165.   dim s as string, c as string
  166.   send #Port,
  167.   send #Port, "You are now chatting with the sysop"
  168.   send #Port,
  169.   do
  170.     c = inkey
  171.     if c = "F2" then
  172.       exit do
  173.     end if
  174.     if c = "" and not Local then
  175.       c = inkey(Port)
  176.     end if
  177.     select case c
  178.       case BS
  179.         if len(s) > 0 then
  180.           s = left(s, len(s)-1)
  181.           send #Port, BS; " "; BS;
  182.         end if
  183.       case CR
  184.         send #Port,
  185.         s = ""
  186.       case is >= " "
  187.         if len(c) = 1 then
  188.           s = s + c
  189.           send #Port, c;
  190.           if len(s) >= 79 then
  191.             if instr(s, " ") then
  192.               dim i as integer
  193.               i = len(s)
  194.               while mid(s, i, 1) <> " "
  195.                 i = i - 1
  196.               wend
  197.               send #Port, string(len(s)-i, BS); string(len(s)-i, " ")
  198.               s = mid(s, i+1, len(s)-i)
  199.               send #Port, s;
  200.             else
  201.               send #Port,
  202.               s = ""
  203.             end if
  204.           end if
  205.         end if
  206.     end select
  207.   loop until CallerHungUp
  208.   send #Port,
  209.   send #Port,
  210.   send #Port, "Returning you to host mode"
  211.   send #Port,
  212. end sub
  213.  
  214. function YesNo(x as integer) as string
  215.   if x then
  216.     YesNo = "Yes"
  217.   else
  218.     YesNo = "No"
  219.   end if
  220. end function
  221.  
  222. declare function GetLine(prompt as string = "", maxlen as integer = 0, start as string = "", passchar as string = "") as string
  223. function GetLine(prompt as string, maxlen as integer, start as string, passchar as string) as string
  224.   dim s as string
  225.   dim starttime as DateTimeRec
  226.   dim warned as integer
  227.   call GetCurrentTime(starttime)
  228.   warned = false
  229.   s = start
  230.   send #Port, prompt; s;
  231.   do
  232.     dim c as string
  233.     c = inkey
  234.     if c = "" and not Local then
  235.       c = inkey(Port)
  236.     end if
  237.     select case c
  238.       case ""
  239.         dim idle as integer
  240.         idle = MinutesSince(starttime)
  241.         if idle >= 4 and not warned then
  242.           send #Port,
  243.           send #Port,
  244.           send #Port, "CAUTION!  You will be logged off if you do not continue in 60 seconds!"
  245.           send #Port,
  246.           send #Port, prompt; s;
  247.           warned = true
  248.         elseif idle >= 5 then
  249.           send #Port,
  250.           send #Port,
  251.           send #Port, "Logged off due to inactivity."
  252.           delay 1
  253.           hangup
  254.           ForceLogoff = True
  255.         end if
  256.       case "F2"
  257.         DoChat
  258.         call GetCurrentTime(starttime)
  259.         send #Port, prompt; s;
  260.       case BS
  261.         if len(s) > 0 then
  262.           s = left(s, len(s)-1)
  263.           send #Port, BS;" ";BS;
  264.         end if
  265.       case CR
  266.         GetLine = s
  267.         send #Port,
  268.         exit function
  269.       case ESC
  270.         ' esc handling
  271.       case is >= " "
  272.         s = s + c
  273.         if len(passchar) > 0 then
  274.           send #Port, passchar;
  275.         else
  276.           send #Port, c;
  277.         end if
  278.         if maxlen > 0 and len(s) >= maxlen then
  279.           GetLine = s
  280.           exit function
  281.         end if
  282.     end select
  283.   loop until TimeLeft < 0 or CallerHungUp
  284.   GetLine = ""
  285. end function
  286.  
  287. function DisplayFile(fn as string) as integer
  288.   dim f as integer, count as integer
  289.   DisplayFile = TRUE
  290.   f = freefile
  291.   open fn for input as #f
  292.   count = 0
  293.   do while not eof(f)
  294.     dim s as string
  295.     input #f, s
  296.     send #Port, s
  297.     count = count + 1
  298.     if count >= 24 then
  299.       if OemUpper(GetLine("-Pause- [C]ontinue, [S]top? ", 1)) = "S" then
  300.         exit do
  301.       end if
  302.       send #Port,
  303.       count = 0
  304.     end if
  305.   loop
  306.   close #f
  307. catch err_fileopen
  308.   DisplayFile = FALSE
  309. end function
  310.  
  311. sub SendModemString(s as string)
  312.   dim i as integer, c as string
  313.   i = 1
  314.   while i <= len(s)
  315.     c = mid(s, i, 1)
  316.     if c = "^" and i+1 <= len(s) then
  317.       i = i + 1
  318.       c = mid(s, i, 1)
  319.       if c = "~" then
  320.         delay 0.5
  321.         goto nextchar
  322.       else
  323.         c = chr(asc(c) and 0x3f)
  324.       end if
  325.     end if
  326.     send c;
  327. nextchar:
  328.     i = i + 1
  329.   wend
  330. end sub
  331.  
  332. sub InitModem
  333.   dim result as string
  334.   hostecho off
  335.   if carrier then exit sub
  336.   timeout 5
  337. tryagain:
  338.   delay 1
  339.   SendModemString ModemSetup.init
  340.   do
  341.     receive result
  342.   loop until result = ModemSetup.ok
  343. catch err_timeout
  344.   goto tryagain
  345. end sub
  346.  
  347. sub InitFaxModem
  348.   hostecho off
  349.   timeout 2
  350.   send "ate0v1"
  351.   delay 1
  352.   send "at+fclass=1"
  353.   delay 1
  354.   send "at+faa=1"
  355.   do
  356.     dim result as string
  357.     receive result
  358.   loop
  359. catch err_timeout
  360. end sub
  361.  
  362. function CheckFaxReceive(s as string)
  363.   CheckFaxReceive = False
  364.   if ModemSetup.faxanswer = 0 then
  365.     exit function
  366.   end if
  367.   if s = "FAX" then
  368.     waitfor "CONNECT"
  369.     if receivefax(1) then
  370.       ReceivedFaxes = ReceivedFaxes + 1
  371.     end if
  372.     send "ATZ"
  373.     delay 2
  374.     CheckFaxReceive = True
  375.   elseif s = "DATA" and ModemSetup.faxato then
  376.     send "ATO"
  377.   end if
  378. end function
  379.  
  380. function WaitForCall as integer
  381.   hostecho off
  382.   if carrier then
  383.     Local = False
  384.     Port = comm
  385.     WaitForCall = True
  386.     exit function
  387.   end if
  388.  
  389.   do
  390.     dim rings as integer
  391.     rings = 0
  392.     dim result as string
  393.     do
  394.       dim c as string
  395.       c = inkey(comm)
  396.       if c = "" then
  397.         c = inkey
  398.         select case OemUpper(c)
  399.           case "F1"
  400.             if ModemSetup.busy <> "" then
  401.               SendModemString ModemSetup.busy
  402.               delay 1
  403.               flush input
  404.             end if
  405.             Local = True
  406.             Port = 0
  407.             WaitForCall = True
  408.             exit function
  409.           case "F7"
  410.             PackMessages
  411.             WaitForCall = False
  412.             exit function
  413.           case "F8"
  414.             SetupHost
  415.             WaitForCall = False
  416.             exit function
  417.           case "F9"
  418.             print "Host mode terminated, returning to normal operation."
  419.             end
  420.         end select
  421.       elseif c = LF then
  422.         result = ""
  423.       else
  424.         result = result + c
  425.         if len(result) > len(ModemSetup.ring) then
  426.           result = right(result, len(result)-1)
  427.         end if
  428.         if result = ModemSetup.ring then
  429.           rings = rings + 1
  430.         end if
  431.       end if
  432.     loop until rings >= val(ModemSetup.ringcount)
  433.     delay 0.2
  434.     SendModemString ModemSetup.answer
  435.     timeout 60
  436.     do
  437.       receive result
  438.       if CheckFaxReceive(result) then
  439.         WaitForCall = FALSE
  440.         exit function
  441.       end if
  442.       if left(result, 7) = "CONNECT" then
  443.         ModemResult = result
  444.         BaudRate = val(right(ModemResult, len(ModemResult)-8))
  445.         Local = False
  446.         Port = comm
  447.         WaitForCall = True
  448.         exit function
  449.       end if
  450.     loop until result = "NO CARRIER"
  451.   loop
  452. catch err_timeout
  453.   WaitForCall = False
  454. end function
  455.  
  456. function NextField(s as string, delim as string) as string
  457.   dim i as integer
  458.   i = instr(s, delim)
  459.   if i > 0 then
  460.     NextField = left(s, i-1)
  461.     s = right(s, len(s)-i)
  462.   else
  463.     NextField = s
  464.     s = ""
  465.   end if
  466. end function
  467.  
  468. function LookupUser(uname as string, user as TUser) as integer
  469.   dim f as integer, s as string
  470.   LookupUser = False
  471.   f = freefile
  472.   open UserFileName for input as #f
  473.   do while not eof(f)
  474.     input #f, s
  475.     dim i as integer
  476.     i = instr(s, ";")
  477.     if i > 0 then
  478.       s = rtrim(left(s, i-1))
  479.     end if
  480.     if OemUpper(uname)+"," = left(s, len(uname)+1) then
  481.       user.Name = NextField(s, ",")
  482.       user.Password = NextField(s, ",")
  483.       user.Level = val(NextField(s, ","))
  484.       user.Phone = NextField(s, ",")
  485.       close #f
  486.       LookupUser = True
  487.       exit function
  488.     end if
  489.   loop
  490.   close #f
  491. catch err_fileopen
  492. end function
  493.  
  494. sub Badpath
  495.    dim sysopdir as string
  496.     if setup.dlpath = "" then
  497.       exit sub
  498.     end if
  499.     sysopdir = setup.dlpath
  500.     chdrive sysopdir
  501.     chdir sysopdir
  502. catch err_path
  503.   send #Port, "HOST error, invalid drive or path."
  504.   send #Port, "Download not available."
  505.   setup.dlpath = ""
  506. end sub
  507.  
  508. function GetPassword as integer
  509.   GetPassword = True
  510.   if User.Password = "" then
  511.     exit function
  512.   end if
  513.   GetPassword = False
  514.   dim password as string, tries as integer
  515.   do
  516.     password = GetLine("Password? ", 0, "", "*")
  517.     if CallerHungUp then
  518.       exit function
  519.     end if
  520.     if OemUpper(password) = OemUpper(User.Password) then
  521.       send #Port, "Password ok"
  522.       GetPassword = True
  523.       exit function
  524.     end if
  525.     tries = tries + 1
  526.     if tries > 3 then
  527.       send #Port,
  528.       send #Port, "Sorry, access denied"
  529.       send #Port,
  530.       exit function
  531.     else
  532.       send #Port,
  533.       send #Port, "Incorrect password entered"
  534.       send #Port,
  535.     end if
  536.   loop
  537.   GetPassword = True
  538. end function
  539.  
  540. function CallUserBack as integer
  541.   CallUserBack = False
  542.   if User.Phone = "" then
  543.     send #Port, "Your phone number is not on file."
  544.     send #Port, "(click)"
  545.     exit function
  546.   end if
  547.   send #Port, "Hanging up now, type ATA and press Enter after you get a ring."
  548.   delay 1
  549.   hostecho off
  550.   hangup
  551.   delay 10
  552.   send "ATDT"; User.Phone
  553.   timeout 60
  554.   dim result as string
  555.   do
  556.     receive result
  557.     if left(result, 7) = "CONNECT" then
  558.       ModemResult = result
  559.       BaudRate = val(right(ModemResult, len(ModemResult)-8))
  560.       exit do
  561.     end if
  562.   loop
  563.   timeout off
  564.   hostecho on
  565.   delay 1
  566.   send #Port, "Welcome "; User.Name
  567.   send #Port,
  568.   if GetPassword then
  569.     CallUserBack = True
  570.   end if
  571. catch err_timeout
  572.   send
  573. end function
  574.  
  575. function GetCallerInfo as integer
  576.   dim uname as string
  577.   do
  578.     uname = OemUpper(GetLine("Please enter your name? "))
  579.     if CallerHungUp then
  580.       GetCallerInfo = False
  581.       exit function
  582.     end if
  583.     if LookupUser(uname, User) then
  584.       if not GetPassword then
  585.         GetCallerInfo = False
  586.         exit function
  587.       end if
  588.       if Setup.modecallback and not Local then
  589.         if not CallUserBack then
  590.           GetCallerInfo = False
  591.           exit function
  592.         end if
  593.       end if
  594.       GetCallerInfo = True
  595.       exit function
  596.     elseif Setup.modeopen then
  597.       User.Name = uname
  598.       send #Port,
  599.       send #Port, "Your name ";chr(34);uname;chr(34);" was not found in the user list."
  600.       if OemUpper(left(GetLine("Is it spelled correctly? "), 1)) = "Y" then
  601.         exit do
  602.       end if
  603.       send #Port,
  604.     else
  605.       send #Port,
  606.       send #Port, "Sorry, you are not registered with this system."
  607.       send #Port, "(click)"
  608.       send #Port,
  609.       GetCallerInfo = False
  610.       exit function
  611.     end if
  612.   loop
  613.   send #Port,
  614.   do
  615.     dim password as string
  616.     User.Password = GetLine("Please select a password? ", 0, "", "*")
  617.     password      = GetLine("Type your password again? ", 0, "", "*")
  618.     if OemUpper(password) = OemUpper(User.Password) then exit do
  619.     send #Port,
  620.     send #Port, "The passwords you typed did not match.  Try again."
  621.     send #Port,
  622.   loop
  623.   User.Level = 0
  624.   open UserFileName for append as #1
  625.   print #1, User.Name;",";User.Password;",";User.Level
  626.   close #1
  627.   send #Port, "Welcome new user!"
  628.   GetCallerInfo = True
  629. catch err_fileopen
  630.   send "Fatal error - could not open user database"
  631.   GetCallerInfo = False
  632. end function
  633.  
  634. '$include 'hostfile.scr'
  635. '$include 'hostmsg.scr'
  636. '$include 'hostdos.scr'
  637.  
  638. sub HelpScreen
  639.   if DisplayFile(HelpFileName) then
  640.     do
  641.       dim s as string
  642.       send #Port,
  643.       send #Port, "Type the letter of the command you would like more help with,"
  644.       s = OemUpper(GetLine("or press Enter to return to the main menu: "))
  645.       if s = "" or CallerHungUp then exit do
  646.       send #Port,
  647.       if not DisplayFile(ConfigScriptPath+"\host" + left(s, 1) + ".hlp") then
  648.         send #Port, "Sorry, no help is available for that item."
  649.       end if
  650.     loop
  651.   else
  652.     send #Port, "Sorry, no help information is available."
  653.   end if
  654. end sub
  655.  
  656. ' Page sysop
  657.  
  658. sub PageSysop
  659.   send #Port, "Paging sysop..."
  660.   print "(Sysop: Press F2 to enter chat mode)"
  661.   play "RINGIN"
  662.   send #Port,
  663.   GetLine "Press Enter to continue? "
  664. end sub
  665.  
  666. sub Shutdown
  667.   if User.Level = 0 or Setup.shutdownpass = "" then
  668.     send #Port, "Sorry, shutdown option not available."
  669.     send #Port,
  670.     exit sub
  671.   end if
  672.   if OemUpper(GetLine("Enter shutdown password: ", 0, "", "*")) <> OemUpper(Setup.shutdownpass) then
  673.     send #Port,
  674.     send #Port, "Wrong password entered."
  675.     send #Port,
  676.     exit sub
  677.   end if
  678.   hangup
  679.   end
  680. end sub
  681.  
  682. do
  683.   PrelogFileName    = ConfigScriptPath+"\"+PrelogFileNamePart
  684.   MenuFileName      = ConfigScriptPath+"\"+MenuFileNamePart
  685.   ProtocolFileName  = ConfigScriptPath+"\"+ProtocolFileNamePart
  686.   LogoffFileName    = ConfigScriptPath+"\"+LogoffFileNamePart
  687.   HelpFileName      = ConfigScriptPath+"\"+HelpFileNamePart
  688.   UserFileName      = ConfigScriptPath+"\"+UserFileNamePart
  689.   MsgHeaderFileName = ConfigScriptPath+"\"+MsgHeaderFileNamePart
  690.   MsgDetailFileName = ConfigScriptPath+"\"+MsgDetailFileNamePart
  691.   LoadConfig
  692.   InitModem
  693.   ReceivedFaxes = 0
  694.   do
  695.     if ModemSetup.faxanswer then
  696.       print "Initializing fax modem..."
  697.       InitFaxModem
  698.     end if
  699.     cls
  700.     print "QmodemPro for Windows Host Mode"
  701.     print "Alternative for version 1.10"
  702.     print
  703.     print "Press F1 to log on locally"
  704.     print "Press F7 to pack the messages"
  705.     print "Press F8 to set up the host mode"
  706.     print "Press F9 to quit the host mode"
  707.     if ReceivedFaxes > 0 then
  708.       print
  709.       print "New faxes: "; ReceivedFaxes
  710.     end if
  711.     print
  712.     if setup.dlpath = "" or setup.ulpath = "" then
  713.       print
  714.       print "WARNING, download\upload path not specified in Host setup."
  715.       Print "Press F8 to set up the host mode download\upload path."
  716.     end if
  717.     print "Modem ready for calls..."
  718.   loop until WaitForCall
  719.   timeout off
  720.   ForceLogoff = False
  721.   print "Call connected at "; BaudRate; " baud"
  722.   hostecho on
  723.   delay 1
  724.   send #Port, "Welcome to the Qmodem for Windows host mode!"
  725.   send #Port,
  726.   send #Port, "Modem result: "; ModemResult
  727.   send #Port, "Connected at "; BaudRate; " bps. ";
  728.   send #Port,
  729.   send #Port,
  730.   DisplayFile PrelogFileName
  731.   Badpath
  732.   call GetCurrentTime(LogonTime)
  733.   call IncDateTime(LogonTime, LogoffTime, 0, val(Setup.MaxTime)*60)
  734.   if GetCallerInfo then
  735.     do
  736.       send #Port,
  737.       DisplayFile MenuFileName
  738.       dim cmd as string
  739.       cmd = GetLine("("+str(TimeLeft)+" min. left) Command? ")
  740.       send #Port,
  741.       select case OemUpper(cmd)
  742.         case "?"
  743.           HelpScreen
  744.         case "D"
  745.           DownloadFile
  746.         case "E"
  747.           EnterMessage
  748.         case "F"
  749.           ListFiles
  750.         case "G"
  751.           DisplayFile LogoffFileName
  752.           send #Port, "Thanks for calling!"
  753.           exit do
  754.         case "P"
  755.           PageSysop
  756.         case "C"
  757.           ChangeDir
  758.         case "R"
  759.           ReadMessages
  760.         case "S"
  761.           DosShell
  762.         case "U"
  763.           UploadFile
  764.         case "Z"
  765.           Shutdown
  766.         case else
  767.           send #Port, "Unknown command, try again"
  768.       end select
  769.     loop until TimeLeft < 0 or CallerHungUp
  770.   end if
  771.   hostecho off
  772.   if not Local then
  773.     delay 1
  774.     hangup
  775.     delay 1
  776.   end if
  777. loop
  778.